3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
You specify the 3D model to be displayed in a viewer pane's picture area by calling either the Q3ViewerUseFile or Q3ViewerUseData function. Q3ViewerUseFile takes a reference to an existing viewer object and a file reference number of an open metafile, as follows:
myErr = Q3ViewerUseFile(myViewer, myFsRefNum);
You use the Q3ViewerUseData function to specify a 3D model whose data is already in memory (either on the Clipboard or elsewhere in RAM). Q3ViewerUseData takes a reference to an existing viewer object, a pointer to the metafile data in RAM, and the number of bytes occupied by that data. Here's an example of calling Q3ViewerUseData :
myErr = Q3ViewerUseData(myViewer, myDataPtr, myDataSize);
The data in the buffer whose address and size you pass to Q3ViewerUseData must be in the QuickDraw 3D Object Metafile format.
Once you attach the metafile data to a visible viewer object, the user is able to see the 3D model in the viewer pane. If, however, the viewer pane was invisible when it was created, you need to call the Q3ViewerDraw function to make it visible.
The 3D Viewer treats the model data as a single group. You can get a reference to the model data currently displayed in the viewer's picture area by calling the Q3ViewerGetGroup function. You can change that model data by calling the Q3ViewerUseGroup function.
You can also retrieve the view object associated with a viewer object by calling the Q3ViewerGetView function. You can then modify some of the view settings, such as the lights or the camera. If you wish, you can also restore the view settings to their original values by calling the Q3ViewerRestoreView function.
In versions 1.1 and later, your application can also set the viewer to display one of several predefined points of view by calling the Q3ViewerSetCameraByView and Q3ViewerSetCameraByNumber functions.
Previous | QD3D Book | Overview | Chapter Contents | Next |